import type {RouteRecordRaw} from "vue-router";
import UserLoginView from "../view/user/UserLoginView.vue";
import UserRegisterView from "../view/user/UserRegisterView.vue";
import QuestionView from "../view/question/QuestionView.vue";
import QuestionDetail from "../view/question/QuestionDetail.vue";
import UserProfile from "../view/user/UserProfile.vue";
import Post from "../view/community/Post.vue";
import More from "../view/More.vue";
import PostAll from "../view/community/PostAll.vue";

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        children: [
            { path: '', name: 'Home', component: QuestionView },
            { path: 'login', name: 'Login', component: UserLoginView}
        ]
    },
    {
        path: '/user',
        children: [
            { path: 'login', name: 'Login', component: UserLoginView},
            { path: 'register', name: 'Register', component: UserRegisterView},
            { path: 'profile', name: 'Profile', component: UserProfile}
        ]
    },
    {
        path: '/questions',
        children: [
            { path: '', name: 'QuestionView', component: QuestionView},
            { path: 'detail/:id', name: 'QuestionSolve', component: QuestionDetail}
        ]
    },
    {
        path: '/community',
        children: [
            {path: '', name: 'post', component: Post}
        ]
    },
    {
        path: '/more',
        children: [
            {path: '', name: 'more', component: More}
        ]
    },
    {
        path: '/community',
        children: [
            {path: '', name: 'Post', component: Post},
            {path: 'detail/:id', name: 'PostDetail', component: PostAll} // 添加帖子详情页路由
        ]
    }
]
export default routes;